package cn.qidisoft.edu.hzjt.controller.zyc;

import cn.qidisoft.core.common.context.ApplicationContextConfigUtil;
import cn.qidisoft.core.common.log.LoggerAdapter;
import cn.qidisoft.core.common.log.LoggerAdapterFactory;
import cn.qidisoft.core.common.pagination.Page;
import cn.qidisoft.core.common.pagination.PaginationBean;
import cn.qidisoft.core.util.file.FileUtil;
import cn.qidisoft.core.util.moffice.excel.ExpExcelUtil;
import cn.qidisoft.edu.hzjt.constants.Constant;
import cn.qidisoft.edu.hzjt.controller.BaseController;
import cn.qidisoft.edu.hzjt.exception.RPCException;
import cn.qidisoft.edu.hzjt.model.BjxxClassMaterialFile;
import cn.qidisoft.edu.hzjt.model.ResponseResult;
import cn.qidisoft.edu.hzjt.model.Student;
import cn.qidisoft.edu.hzjt.model.UserEmployee;
import cn.qidisoft.edu.hzjt.model.xb.PartyResponsibilityAttEn;
import cn.qidisoft.edu.hzjt.model.zyc.DeveAmateurSchool;
import cn.qidisoft.edu.hzjt.model.zyc.DeveAmateurSchoolAtt;
import cn.qidisoft.edu.hzjt.model.zyc.DeveAmateurSchoolStudent;
import cn.qidisoft.edu.hzjt.service.zyc.IDeveAmateurSchoolService;
import cn.qidisoft.edu.hzjt.service.zyc.IStudentService;
import cn.qidisoft.edu.hzjt.utils.CommonUtils;
import cn.qidisoft.edu.hzjt.utils.LogType;
import com.alibaba.fastjson.JSONObject;
import com.fasterxml.jackson.databind.ObjectMapper;
import org.apache.commons.io.FilenameUtils;
import org.apache.ibatis.annotations.Param;
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.multipart.MultipartFile;

import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.text.SimpleDateFormat;
import java.util.*;

/**
 * 
 * @author 党校业余活动开展控制器
 */
@Controller
@RequestMapping(value = "/deveAmateurSchool")
public class DeveAmateurSchoolController {
	protected static final LoggerAdapter LOGGER = LoggerAdapterFactory.getLogger(LogType.HZJT_LOGGER.val);

	private static String upload = null;
	static {
		upload = ApplicationContextConfigUtil.getString("file.path", null);
	}

	private static Map<String, List<PartyResponsibilityAttEn>> picMap = new HashMap<>();

	@Autowired
	private IDeveAmateurSchoolService deveAmateurSchoolService;

	@Autowired
	private IStudentService studentService;

	/**
	 * 跳转到列表页面
	 */
	@RequestMapping(value = "/list")
	public String list() {
		return "zyc/developmentAmateurSchool/list";
	}

	/**
	 * 
	 * 分页查看所有表格信息
	 */
	@RequestMapping(value = "/listData")
	@ResponseBody
	public ResponseResult sleDeveAmateurSchool(ModelMap model, HttpServletRequest request,
			@RequestParam(value = "rows", required = false) String pageSize,
			@RequestParam(value = "page", required = false) String currentPage, DeveAmateurSchool deveAmateurSchool) {
		try {
			Page page = new Page();
			if (deveAmateurSchool.getDxqs() != null || deveAmateurSchool.getSkzt() != null) {
				deveAmateurSchool.setDxqs(deveAmateurSchool.getDxqs().replaceAll(" ", ""));
				deveAmateurSchool.setSkzt(deveAmateurSchool.getSkzt().replaceAll(" ", ""));
			}
			Map<String, Object> queryMap = new HashMap<String,Object>();
			Integer type = (Integer)request.getSession().getAttribute(Constant.LOGIN_USER_TYPE);
			Integer xsid = 0;
			if(type == 1) {
				Student student = (Student) request.getSession().getAttribute(Constant.LOGIN_CONSOLE_USER);
				xsid = student.getXsid();
			}
			queryMap.put("xsid", xsid);
			page.setCurrPage(currentPage == null ? 0 : Integer.valueOf(currentPage));
			page.setPageSize(pageSize == null ? 10 : Integer.valueOf(pageSize));
			BaseController.setSortByColumn(request, "createTime", "asc");
			deveAmateurSchool.setOrderField((String) request.getAttribute("orderField"));
			deveAmateurSchool.setOrderFlag((String) request.getAttribute("orderFlag"));
			queryMap.put("deveAmateurSchool", deveAmateurSchool);
			PaginationBean<DeveAmateurSchool> paginationBean = deveAmateurSchoolService
					.queryDeveAmateurSchoolPageList(queryMap, page);
			ResponseResult result = new ResponseResult();
			result.setTotal(paginationBean.getTotalRecords());
			result.setRows(paginationBean.getPageList());
			return result;
		} catch (Exception e) {

		}
		return null;
	}

	/**
	 * 删除数据
	 */
	@RequestMapping(value = "/delete")
	public String Delete(HttpServletRequest request) {
		String stringIdList = request.getParameter("idList");
		List<Integer> id_List = new ArrayList<>();
		if (stringIdList.contains(",")) {
			String idlist[] = stringIdList.split(",");
			for (String lists : idlist) {
				id_List.add(Integer.parseInt(lists));
			}
			deveAmateurSchoolService.deleteByIds(id_List);
		} else {
			id_List.add(Integer.parseInt(stringIdList));
			deveAmateurSchoolService.deleteByIds(id_List);
		}
		return "redirect:./list";
	}

	/**
	 * 跳转到增加页面
	 */
	@RequestMapping(value = "/preadd", method = RequestMethod.GET)
	public String preadd(Model model, HttpServletRequest request) {
		try {
			// 得到登陆人的信息
			UserEmployee userEmployee = (UserEmployee) request.getSession().getAttribute(Constant.LOGIN_CONSOLE_USER);
			model.addAttribute("emid", userEmployee.getEmid());
			model.addAttribute("xm", userEmployee.getXm());
			model.addAttribute("zgh", userEmployee.getZgh());
			List<Student> selStudent = studentService.selStudent();
			request.setAttribute("students", selStudent);
			ObjectMapper mapper = new ObjectMapper();
			String json = mapper.writeValueAsString(selStudent);
			request.setAttribute("json", json);
		} catch (Exception e) {
			e.printStackTrace();
		}
		return "zyc/developmentAmateurSchool/add";
	}

	/**
	 * 增加数据
	 */
	@RequestMapping(value = "/add")
	public String add(ModelMap model, HttpServletRequest request, HttpSession session, DeveAmateurSchool data) {

		try {
			UserEmployee user = (UserEmployee) session.getAttribute(Constant.LOGIN_CONSOLE_USER);
			data.setCreatorId(user.getEmid());
			// 在构造器中传入日期样式
			SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
			// 当前系统时间
			Date dateTime = new Date();
			// 调用format Date date 对象传入的日期参数进行格式化
			String datetime = simpleDateFormat.format(dateTime);
			data.setCreateTime(datetime);
			data.setGid("");
			deveAmateurSchoolService.insert(data);
			model.put("data", data);

			UserEmployee userEnrollee = (UserEmployee) request.getSession().getAttribute(Constant.LOGIN_CONSOLE_USER);
			String filePath = CommonUtils.createSaveFilePath("ZHDJ_YYDX_DXGL", userEnrollee.getUserid());
			String path = upload;
			List<PartyResponsibilityAttEn> docFileResourceList = picMap.get(String.valueOf(user.getUserid()));
			if (docFileResourceList != null && !docFileResourceList.isEmpty()) {
				MultipartFile file = null;
				for (PartyResponsibilityAttEn r : docFileResourceList) {
					file = r.getMufile();
					r.setParentId(data.getDxid());
					String name = file.getOriginalFilename();// 获取上传文件名
					InputStream in = r.getInputStream();// 获取文件对象
					int pos = name.lastIndexOf(".");
					String lastname = name.substring(pos, name.length());
					// 文件保存的路径
					String savePath = path + CommonUtils.fileSeprator + filePath;
					FileUtil.saveFile(savePath, in, r.getGid() + lastname);
					r.setGid(r.getGid());// 附件id
					r.setFileName(name);
				}
				deveAmateurSchoolService.batchInsertsFiles(docFileResourceList);
				// 一旦上传成功需要清空，否则下一次上传的时候又刚一遍了~
				picMap.remove(String.valueOf(user.getUserid()));
			}
			String action = request.getParameter("action");
			if (action.equals("1")) {
				return "redirect:./details?dxid=" + data.getDxid();
			} else if (action.equals("2")) {
				return "redirect:./preadd";
			}
		} catch (Exception e) {
			e.getSuppressed();
		}
		return null;

	}

	/**
	 * 跳修改页面
	 */
	@RequestMapping("/updateUI")
	public String updateUI(Model model, @Param("dxid") Integer dxid, HttpServletRequest request) {

		try {

			List<Student> selStudent = studentService.selStudent();
			request.setAttribute("students", selStudent);
			ObjectMapper mapper = new ObjectMapper();
			String json = mapper.writeValueAsString(selStudent);
			request.setAttribute("json", json);

			UserEmployee userEmployee = (UserEmployee) request.getSession().getAttribute(Constant.LOGIN_CONSOLE_USER);
			DeveAmateurSchool deveAmateurSchool = deveAmateurSchoolService.queryDeveAmateurSchoolById(dxid);
			model.addAttribute("das", deveAmateurSchool);
			model.addAttribute("xm", userEmployee.getXm());
			model.addAttribute("students", studentService.selStudent());

			List<DeveAmateurSchoolStudent> deveAmateurSchoolStudentsList = deveAmateurSchool
					.getDeveAmateurSchoolStudentsList();
			ObjectMapper mapper1 = new ObjectMapper();
			String deveAmateurSchoolStudentsJSON = mapper1.writeValueAsString(deveAmateurSchoolStudentsList);
			request.setAttribute("deveAmateurSchoolStudentsJSON", deveAmateurSchoolStudentsJSON + "");

			// 获取附件信息
			PartyResponsibilityAttEn att = new PartyResponsibilityAttEn();
			att.setParentId(dxid);
			List<PartyResponsibilityAttEn> attList = deveAmateurSchoolService.queryFilesList(att);
			request.setAttribute("dataList", attList);

		} catch (Exception e) {
			e.printStackTrace();
		}

		return "zyc/developmentAmateurSchool/update";
	}

	/**
	 * 修改表格数据
	 */
	@RequestMapping(value = "/update")
	public String update(ModelMap model, HttpServletRequest request, HttpSession session, DeveAmateurSchool data) {
		try {
			UserEmployee user = (UserEmployee) session.getAttribute(Constant.LOGIN_CONSOLE_USER);
			data.setCreatorId(user.getEmid());
			data.setCreatorName(user.getName());
			// 在构造器中传入日期样式
			SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
			// 当前系统时间
			Date dateTime = new Date();
			// 调用format Date date 对象传入的日期参数进行格式化
			String datetime = simpleDateFormat.format(dateTime);
			System.out.println(data.getDxid());
			data.setCreateTime(datetime);
			data.setGid("");
			deveAmateurSchoolService.update(data);
			model.put("data", data);

			UserEmployee userEnrollee = (UserEmployee) request.getSession().getAttribute(Constant.LOGIN_CONSOLE_USER);
			String filePath = CommonUtils.createSaveFilePath("ZHDJ_YYDX_DXGL", userEnrollee.getUserid());
			String path = upload;
			List<PartyResponsibilityAttEn> docFileResourceList = picMap.get(String.valueOf(user.getUserid()));
			if (docFileResourceList != null && !docFileResourceList.isEmpty()) {
				MultipartFile file = null;
				for (PartyResponsibilityAttEn r : docFileResourceList) {
					file = r.getMufile();
					r.setParentId(data.getDxid());
					String name = file.getOriginalFilename();// 获取上传文件名
					InputStream in = r.getInputStream();// 获取文件对象
					int pos = name.lastIndexOf(".");
					String lastname = name.substring(pos, name.length());
					// 文件保存的路径
					String savePath = path + CommonUtils.fileSeprator + filePath;
					FileUtil.saveFile(savePath, in, r.getGid() + lastname);
					r.setGid(r.getGid());// 附件id
					r.setFileName(name);
				}
				deveAmateurSchoolService.batchInsertsFiles(docFileResourceList);
				// 一旦上传成功需要清空，否则下一次上传的时候又刚一遍了~
				picMap.remove(String.valueOf(user.getUserid()));
			}

			String action = request.getParameter("action");
			if (action.equals("1")) {
				return "redirect:./details?dxid=" + data.getDxid();// return "zyc/developmentAmateurSchool/details";
			} else if (action.equals("2")) {
				return "redirect:./preadd";
			}
		} catch (Exception e) {
			e.getSuppressed();
		}
		return null;
	}

	/**
	 * 跳预览页面
	 */
	@RequestMapping(value = "/details")
	public String details(HttpServletRequest request, Model model, Integer dxid) {
		try {
			UserEmployee userEmployee = (UserEmployee) request.getSession().getAttribute(Constant.LOGIN_CONSOLE_USER);
			DeveAmateurSchool deveAmateurSchool = deveAmateurSchoolService.queryDeveAmateurSchoolById(dxid);
			if(null !=deveAmateurSchool.getCreateTime()) {
				deveAmateurSchool.setCreateTime(deveAmateurSchool.getCreateTime().substring(0, 19));
			}
			
			
			model.addAttribute("data", deveAmateurSchool);
			model.addAttribute("xm", userEmployee.getXm());
			model.addAttribute("students", studentService.selStudent());
			List<DeveAmateurSchoolStudent> deveAmateurSchoolStudentsList = deveAmateurSchool
					.getDeveAmateurSchoolStudentsList();
			ObjectMapper mapper1 = new ObjectMapper();
			String deveAmateurSchoolStudentsJSON = mapper1.writeValueAsString(deveAmateurSchoolStudentsList);
			request.setAttribute("deveAmateurSchoolStudentsJSON", deveAmateurSchoolStudentsJSON + "");
			// 获取附件信息
			PartyResponsibilityAttEn att = new PartyResponsibilityAttEn();
			att.setParentId(dxid);
			List<PartyResponsibilityAttEn> attList = deveAmateurSchoolService.queryFilesList(att);
			request.setAttribute("dataList", attList);
		} catch (Exception e) {
			e.printStackTrace();
		}
		return "zyc/developmentAmateurSchool/details";
	}
	
	/**
	 * 跳预览页面
	 */
//	@RequestMapping(value = "/details_stu")
//	public String details_stu(HttpServletRequest request, Model model) {
//
//		try {
//			
//			Student student = (Student) request.getSession().getAttribute(Constant.LOGIN_CONSOLE_USER);
//			// 根据学生id获取获取业余党校id
//			Integer xsid = student.getXsid();
//			DeveAmateurSchoolStudent dAmateurSchoolStudent = deveAmateurSchoolService.getParendById(xsid);
//			if(null != dAmateurSchoolStudent) {
//				Integer dxid = dAmateurSchoolStudent.getParentId();
//				DeveAmateurSchool deveAmateurSchool = deveAmateurSchoolService.queryDeveAmateurSchoolById(dxid);				
//				if(null !=deveAmateurSchool.getCreateTime()) {
//					deveAmateurSchool.setCreateTime(deveAmateurSchool.getCreateTime().substring(0, 19));
//				}
//				model.addAttribute("data", deveAmateurSchool);
//				model.addAttribute("xm", student.getXm());
//				model.addAttribute("students", studentService.selStudent());
//				List<DeveAmateurSchoolStudent> deveAmateurSchoolStudentsList = deveAmateurSchool
//						.getDeveAmateurSchoolStudentsList();
//				ObjectMapper mapper1 = new ObjectMapper();
//				String deveAmateurSchoolStudentsJSON = mapper1.writeValueAsString(deveAmateurSchoolStudentsList);
//				request.setAttribute("deveAmateurSchoolStudentsJSON", deveAmateurSchoolStudentsJSON + "");
//				// 获取附件信息
//				PartyResponsibilityAttEn att = new PartyResponsibilityAttEn();
//				att.setParentId(dxid);
//				List<PartyResponsibilityAttEn> attList = deveAmateurSchoolService.queryFilesList(att);
//				request.setAttribute("dataList", attList);
//			}
//		} catch (Exception e) {
//			e.printStackTrace();
//		}
//		return "zyc/developmentAmateurSchool/details";
//	}

	/**
	 * 
	 * 查询所有学生
	 */
	@RequestMapping(value = "/selStudent")
	@ResponseBody
	public List<Student> selStudent(String stuid) {
		List<Integer> stu_id = new ArrayList<Integer>();
		if (stuid.contains(",")) {
			String substring = stuid.substring(0, stuid.length() - 1);
			System.out.println(substring);
			String[] split = substring.split(",");
			System.out.println(split[1]);
			for (String string : split) {
				stu_id.add(Integer.parseInt(string));
				System.out.println(stu_id);
			}
		}
		List<Student> studentList = studentService.queryStudentByIds(stu_id);
		return studentList;
	}

	/**
	 * 导出数据
	 */
	@RequestMapping(value = "export")
	public @ResponseBody void export(HttpServletRequest request, HttpServletResponse response, DeveAmateurSchool pM2)
			throws Exception {
		try {
			pM2.setDxqs(request.getParameter("dxqs"));
			pM2.setSkzt(request.getParameter("skzt"));
			List<DeveAmateurSchool> datalist = deveAmateurSchoolService.getDASList(pM2);
			String[][] title_name = { { "党校ID", "gID", "党校期数", "授课主题", "授课时间", "授课地点", "计划参与人数", "实际授课人数", "备注",
					"创建人ID", "创建人", "创建时间" } };
			String[] title_style = { "hwzs_16_bold_25", "hwzs_16_bold_25", "hwzs_16_bold_25", "hwzs_16_bold_25",
					"hwzs_16_bold_25", "hwzs_16_bold_25", "hwzs_16_bold_25", "kt_12_bold_18", "kt_12_bold_18",
					"kt_12_bold_18", "st_12_r_20", "st_12_r_20" };
			String fileName = "业余党校开展情况";
			String[] remark = { "" };
			List<Map<String, Object>> list = new ArrayList<Map<String, Object>>();
			if (datalist != null && !datalist.isEmpty()) {
				for (DeveAmateurSchool res : datalist) {
					Map<String, Object> map = new LinkedHashMap<String, Object>();
					map.put("dxid", res.getDxid());
					map.put("gid", res.getGid());
					map.put("dxqs", res.getDxqs());
					map.put("skzt", res.getSkzt());
					map.put("sksj", res.getSksj());
					map.put("skdd", res.getSkdd());
					map.put("jhcyrs", res.getJhcyrs());
					map.put("sjskrs", res.getSjskrs());
					map.put("remark", res.getRemark());
					map.put("creatorId", res.getCreatorId());
					map.put("creatorName", res.getCreatorName());
					map.put("createTime", res.getCreateTime());
					list.add(map);
				}
			}
			HSSFWorkbook wb = ExpExcelUtil.getWorkBookExcel(title_name, title_style, 100, remark, fileName, list);
			try {
				String filenameConvert = "活动开展信息";
				new String(fileName.getBytes("GB2312"), "ISO8859-1");
				response.reset();
				response.setContentType("application/vnd.ms-excel;charset=utf-8");
				response.setHeader("Content-Disposition",
						"attachment;filename=" + new String((filenameConvert + ".xls").getBytes(), "iso-8859-1"));
				response.setDateHeader("Expires", 0);
				ServletOutputStream os = response.getOutputStream();
				wb.write(os);
				os.flush();
			} catch (Exception e) {
				System.out.println("网络连接断开，可能用户取消了导出");
			}
		} catch (RPCException e) {
			LOGGER.error("获得xxxxx信息 exportStudentjobList [{}] error," + this.getClass().getName() + "=[{}]",
					this.getClass().getName(), e.getMessage());
		}
	}

	/**
	 *
	 * @Title: loadFile @Description: 附件上传 @param @param file @param @param
	 *         request @param @param response 参数 @return void 返回类型 @throws
	 */
	@RequestMapping(value = "/source_upload", method = RequestMethod.POST)
	public @ResponseBody void source_upload(@RequestParam("file") MultipartFile file, HttpServletRequest request,
			HttpServletResponse response) {

		List<PartyResponsibilityAttEn> list = new ArrayList<>();
		UserEmployee userEnrollee = (UserEmployee) request.getSession().getAttribute(Constant.LOGIN_CONSOLE_USER);
		List<PartyResponsibilityAttEn> docFileResourceList = picMap.get(String.valueOf(userEnrollee.getUserid()));
		// 本地env配置路径
		String path = upload;
		try {
			String gid = UUID.randomUUID().toString();

			String filePath = CommonUtils.createSaveFilePath("ZHDJ_YYDX_DXGL", userEnrollee.getUserid());
			String name = file.getOriginalFilename();// 获取上传文件名
			// 获取文件后缀名称
			String extend = FilenameUtils.getExtension(name);
			PartyResponsibilityAttEn docFile = new PartyResponsibilityAttEn();
			if (!file.isEmpty()) {
				// 文件的大小
				docFile.setFileSize(String.valueOf(FileUtil.FormetFileSize(Long.valueOf(file.getSize()))));
				docFile.setFileName(name);
				docFile.setGid(gid);
				docFile.setFilePath(filePath + gid + "." + extend);
				docFile.setExtension(FileUtil.getFileExtendName(name).toLowerCase());
				docFile.setMufile(file);
				docFile.setInputStream(file.getInputStream());
				docFile.setSysfilepath(path + CommonUtils.fileSeprator + filePath + gid + "." + extend);
				docFile.setOrders(0);
				if (docFileResourceList != null && docFileResourceList.size() > 0) {
					docFileResourceList.add(docFile);
					picMap.put(String.valueOf(userEnrollee.getUserid()), docFileResourceList);
				} else {
					list.add(docFile);
					picMap.put(String.valueOf(userEnrollee.getUserid()), list);
				}
				LOGGER.info("附件上传成功！");
			}
			PrintWriter writer = null;
			BjxxClassMaterialFile docFile2 = new BjxxClassMaterialFile();
			docFile2.setFilepath(docFile.getFilePath());
			// 文件名称
			docFile2.setFilename(docFile.getFileName());
			docFile2.setSysfilepath(path + CommonUtils.fileSeprator + filePath + gid + "." + extend);
			writer = response.getWriter();
			String json = JSONObject.toJSONString(docFile2);
			writer.write(json);
			writer.flush();
			writer.close();
		} catch (IOException e) {
			e.printStackTrace();
		}
	}

	/**
	 * 
	 * @Title: source_upload_update @Description: 删除附件 @param @param
	 *         fileId @param @param request @param @param response @param @return
	 *         参数 @return Map<String,Object> 返回类型 @throws
	 */
	@RequestMapping(value = "/source_upload_update", method = RequestMethod.POST)
	public @ResponseBody Map<String, Object> source_upload_update(@RequestParam("fileId") String fileId,
			@RequestParam("filePath") String filePath, HttpServletRequest request, HttpServletResponse response) {
		Map<String, Object> dataMap = new HashMap<String, Object>();
		try {
			System.out.println("id##" + fileId + "路径@@" + filePath);
			DeveAmateurSchoolAtt deveAtt = new DeveAmateurSchoolAtt();
			deveAtt.setFileId(Integer.parseInt(fileId));
			DeveAmateurSchoolAtt deveAmateurSchoolAtt = deveAmateurSchoolService.selPartyAmateurSchoolAttById(deveAtt);
			filePath = deveAmateurSchoolAtt.getFilePath();
			// 删除表记录
			PartyResponsibilityAttEn attEntity = new PartyResponsibilityAttEn();
			attEntity.setFileId(Integer.parseInt(fileId));
			deveAmateurSchoolService.deleteAccessory(attEntity);
			// 删除原始文件
			File file = new File(upload + CommonUtils.fileSeprator + filePath);
			file.delete();
			// 删除目录
			// String[] str = filePath.split("\\.");
			// FileUtils.forceDelete(
			// new File(upload + File.separator + str[0].substring(str[0].length() - 36,
			// str[0].length()))); // 最后删除文件目录
			dataMap.put("success", "0000");
		} catch (Exception e) {
			LOGGER.error("调用services网络异常", e);
			dataMap.put("success", "-9999");
		}
		return dataMap;
	}

}
